package com.bootx.config;

import dev.langchain4j.model.chat.ChatLanguageModel;
import dev.langchain4j.model.chat.StreamingChatLanguageModel;
import dev.langchain4j.model.image.ImageModel;
import dev.langchain4j.model.ollama.OllamaChatModel;
import dev.langchain4j.model.ollama.OllamaStreamingChatModel;
import dev.langchain4j.model.openai.OpenAiChatModel;
import dev.langchain4j.model.openai.OpenAiImageModel;
import dev.langchain4j.model.openai.OpenAiStreamingChatModel;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author black
 */
@Configuration
public class ChatModelConfig {

    @Bean(name = "openAiChatModel")
    public ChatLanguageModel openAiChatModel() {
        return OpenAiChatModel.builder()
                .apiKey("sk-j47dE2qVRvW7mJdpnb6GkwodymhU4PczyvTYhPqfFxED7rXz")
                .baseUrl("https://xiaoai.plus/v1")
                .modelName("gpt-4o")
                .build();
    }

    @Bean(name = "ollamaChatModel")
    public ChatLanguageModel ollamaChatModel() {
        return OllamaChatModel.builder()
                .baseUrl("http://localhost:11434")
                .modelName("deepseek-r1")
                .build();
    }
    @Bean(name = "deepSeekChatModel")
    public ChatLanguageModel deepSeekChatModel() {
        return OpenAiChatModel.builder()
                .apiKey("sk-b76bd6d37f444d1b9ff97cb9699d30e2")
                .baseUrl("https://api.deepseek.com")
                .modelName("deepseek-chat")
                .build();
    }


    @Bean(name = "openAiStreamingChatModel")
    public StreamingChatLanguageModel openAiStreamingChatModel() {
        return OpenAiStreamingChatModel.builder()
                .apiKey("sk-j47dE2qVRvW7mJdpnb6GkwodymhU4PczyvTYhPqfFxED7rXz")
                .baseUrl("https://xiaoai.plus/v1")
                .modelName("gpt-4o")
                .build();
    }

    @Bean(name = "ollamaStreamingChatModel")
    public StreamingChatLanguageModel ollamaStreamingChatModel() {
        return OllamaStreamingChatModel.builder()
                .baseUrl("http://localhost:11434")
                .modelName("qwen2.5")
                .build();
    }



    @Bean(name = "deepSeekStreamingChatModel")
    public StreamingChatLanguageModel deepSeekStreamingChatModel() {
        return OpenAiStreamingChatModel.builder()
                .apiKey("sk-b76bd6d37f444d1b9ff97cb9699d30e2")
                .baseUrl("https://api.deepseek.com")
                .modelName("deepseek-chat")
                .build();
    }


    @Bean(name = "openAiImageModel")
    public ImageModel openAiImageModel() {
        return OpenAiImageModel.builder()
                .apiKey("sk-j47dE2qVRvW7mJdpnb6GkwodymhU4PczyvTYhPqfFxED7rXz")
                .baseUrl("https://xiaoai.plus/v1")
                .modelName("gpt-4o")
                .build();
    }

}
